home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
pctj0987.arc
/
MACRO.C
< prev
next >
Wrap
Text File
|
1987-07-02
|
6KB
|
188 lines
/*
* MACRO -- PC Tech Journal Laser Printer Macro Tests
*
* Version 1.0
*
* Copyright (c) 1987, Ziff Communications Company
* Program by: Rainer McCown
*
* This program creates three macros that draw raster graphics.
* Then other macros are called which in turn call the first
* macros. The final test determines the maximum calling depth.
*/
#include "io.h"
#define STD_OUT 1
extern void sndl(char [], int),
snd (char []),
setbinary(int);
/******************************* MAIN *******************************/
void main()
{
int row, cnt, bit;
unsigned char byte;
/* Change STD_OUT to binary mode to avoid
converting LFs to CR,LF and to avoid
stopping on EOFs
*/
setbinary(STD_OUT);
/* Initialize the printer */
snd("\x1BE"); /* Reset the printer */
snd("\x1B&l0E"); /* Zero the top margin */
snd("\x1B&s1C"); /* Disable EOL wrap */
snd("\x1B9"); /* Clear margins */
snd("\x1B&l0O"); /* Landscape mode */
/* Build the macros */
snd("\x1B&f1Y\x1B&f0X"); /* Start macro #1 definition */
snd("\x1B*t150R"); /* Resolution = 150dpi */
snd("\x1B*r1A"); /* Start raster graphic */
/* Send the bit pattern for a hollow box */
snd("\x1B*b5W\xFF\xFF\xFF\xFF\xFF"); /* Top */
for (cnt = 0; cnt < 31; cnt ++) /* Mid */
sndl("\x1B*b5W\x80\x00\x00\x00\x01", 10);
snd("\x1B*b5W\xFF\xFF\xFF\xFF\xFF"); /* Bottom */
/* End the box and the macro */
snd("\x1B*rB\x1B&f1X");
/* Position cursor, execute macro #1 */
snd("\x1B*p100X\x1B*p120Y\x1B&f1y2X");
snd("\x1B&f2Y\x1B&f0X"); /* Start macro #2 definition */
snd("\x1B*t100R"); /* Resolution = 100dpi */
snd("\x1B*r1A"); /* Start raster graphic */
/* Send the bit pattern for an I */
snd("\x1B*b5W\xFF\xFF\xFF\xFF\xFF"); /* Top */
for (cnt = 0; cnt < 31; cnt ++) /* Mid */
sndl("\x1B*b5W\x00\x00\x18\x00\x00", 10);
snd("\x1B*b5W\xFF\xFF\xFF\xFF\xFF"); /* Bottom */
/* End the I and the macro */
snd("\x1B*rB\x1B&f1X");
/* Position cursor, execute macro #2 */
snd("\x1B*p300X\x1B*p100Y\x1B&f2y2X");
/* Start macro #3 definition */
snd("\x1B&f3Y\x1B&f0X");
/* Position and then call macros #1,#2,#1 */
snd("\x1B*p+00X\x1B*p+00Y\x1B&f1y3X");
snd("\x1B*p+35X\x1B*p-82Y\x1B&f2y3X");
snd("\x1B*p+75X\x1B*p-82Y\x1B&f1y3X");
/* End macro #3 definition */
snd("\x1B&f1X");
/* Position cursor, execute macro #3 */
snd("\x1B*p900X\x1B*p100Y\x1B&f3y2X");
snd("\x1B&f0Y\x1B&f0X"); /* Start macro #0 definition */
snd("\x1B*t300R"); /* Resolution = 300dpi */
snd("\x1B*r1A"); /* Start raster graphic */
/* Send the bit pattern for a solid box */
snd("\x1B*b5W\xFF\xFF\xFF\xFF\xFF"); /* Top */
for (cnt = 0; cnt < 31; cnt++) /* Mid */
snd("\x1B*b5W\xFF\xFF\xFF\xFF\xFF");
snd("\x1B*b5W\xFF\xFF\xFF\xFF\xFF"); /* Bottom */
/* End the box and macro #0 */
snd("\x1B*rB\x1B&f1X");
/* Position cursor, execute macro #0 */
snd("\x1B*p500X\x1B*p130Y\x1B&f0y2X");
/* Start macro #32768 definition */
snd("\x1B&f32768Y\x1B&f0X");
/* Position and then call macros #0,#2,#3 */
snd("\x1B*p100X\x1B*p730Y\x1B&f0y3X");
snd("\x1B*p135X\x1B*p700Y\x1B&f2y3X");
snd("\x1B*p700X\x1B*p700Y\x1B&f3y3X");
/* End macro #32768 definition */
snd("\x1B&f1X");
/* Position cursor, execute macro #32768 */
snd("\x1B*p900X\x1B*p100Y\x1B&f32768y2X");
/***************** Start macro depth test ****************/
/* The LaserJet allows a depth of two only */
snd("\x1B&f6Y\x1B&f0X"); /* Start macro #6 definition */
/* Position and then call macro #7 */
snd("\x1B*p+50X\x1B*p+70Y6\x1B&f7y3X");
snd("a\x1B&f1X"); /* End macro #6 definition */
snd("\x1B&f7Y\x1B&f0X"); /* Start macro #7 definition */
/* Position and then call macro #8 */
snd("\x1B*p+50X\x1B*p+70Y7\x1B&f8y3X");
snd("b\x1B&f1X"); /* End macro #7 definition */
snd("\x1B&f8Y\x1B&f0X"); /* Start macro #8 definition */
/* Position and then call macro #9 */
snd("\x1B*p+50X\x1B*p+70Y8\x1B&f9y3X");
snd("c\x1B&f1X"); /* End macro #8 definition */
snd("\x1B&f9Y\x1B&f0X"); /* Start macro #9 definition */
/* Position and then call macro #10 */
snd("\x1B*p+50X\x1B*p+70Y9\x1B&f10y3X");
snd("d\x1B&f1X"); /* End macro #9 definition */
snd("\x1B&f10Y\x1B&f0X"); /* Start macro #10 definition */
/* Position and then call macro #10 */
snd("\x1B*p+50X\x1B*p+70Y10\x1B&f10y3X");
snd("e\x1B&f1X"); /* End macro #10 definition */
snd("\x1B&f11Y\x1B&f0X"); /* Start macro #11 definition */
/* Position and then redefine macro #11 */
snd("\x1B*p+50X\x1B*p+70Y11");
snd("\x1B&f11Y\x1B&f0X"); /* Restart macro #11 definition */
snd("\x1B*p+50X\x1B*p+70Y11");
snd("\x1B&f11Y\x1B&f0X"); /* Restart macro #11 definition */
snd("\x1B*p+50X\x1B*p+70Y11");
snd("\x1B&f11Y\x1B&f0X"); /* Restart macro #11 definition */
snd("\x1B*p+50X\x1B*p+70Y11");
snd("f\x1B&f1X"); /* End macro #11 definition */
snd("\x1B&f-1Y\x1B&f0X"); /* Start macro #-1 definition */
/* Position and type -1 */
snd("\x1B*p+50X\x1B*p+70Y-1");
snd("g\x1B&f1X"); /* End macro #-1 definition */
/* Position cursor, execute macro #6 */
snd("\x1B*p100X\x1B*p900Y\x1B&f6y2X");
/******************* End macro depth test ****************/
snd("\x1B*p400X\x1B*p900Y\x1B&f10y2X"); /* recursive test */
snd("\x1B*p800X\x1B*p900Y\x1B&f11y2X"); /* redefinition test */
snd("\x1B*p1200X\x1B*p900Y\x1B&f-1y2X");
/* Eject page */
snd("\f");
} /* End MAIN */